package com.DeliveryProgram.www.po;

import com.DeliveryProgram.www.dao.Acot;
import com.DeliveryProgram.www.util.Scanners;
import com.DeliveryProgram.www.util.Screens;

//*关于用户账号管理的类*/
public class Account {
    /**用户名*/
    private String name;
    /**密码*/
    private String password;
    /**数据库中的id*/
    private int id;
    /**用户类型，顾客为1，店家为2*/
    private int user;


    public Account(String name,String password) {
        this.name = name;
        this.password=password;
    }
    public Account(String name) {
        this.name = name;

    }

    /**登录用户账号*/
    public static Account login(){
        System.out.println("请输入用户名");
        String str1=Scanners.getScanner();
        System.out.println("请输入密码");
        String str2=Scanners.getScanner();
        Screens.clear();
        return new Account(str1,str2);

    }

    /**注册用户账号*/
    public static boolean enroll(Acot acot){

        System.out.println("请输入用户名(少于20字)");
        acot.setAccount(new Account(Scanners.getScanner()));
        return acot.enroll();
    }


    public String getName() {
        return name;
    }

    public String getPassword() {
        return password;
    }

    public int getUser() {
        return user;
    }

    public void setUser(int user)
    {
        this.user=user;
    }



}
